//
//  SocketClientManage.h
//  Calibration
//
//  Created by ViKing Lai on 2018/1/24.
//  Copyright © 2018年 ViKing Lai. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>

@interface SocketClient : NSObject<GCDAsyncSocketDelegate>
-(instancetype)initClient:(NSString *)ipAddress andPort:(NSUInteger)port andDelegate:(id)dele;
-(instancetype)initClient:(NSString *)ipAddress andPort:(NSUInteger)port ;
-(BOOL)connect ;
-(BOOL)isDisConnect;

-(void)disconnect ;
-(BOOL)isConnected;
-(void)setAutoRelink:(BOOL)isAutoRelink ;
-(void)sendData:(NSString *)data ;
-(NSString *)getAllData ;
-(NSData *)getAllDataByte;
-(NSString *)ReadTo:(NSString*)data timeOut:(double)timeout Interval:(double) interval ;
-(NSString *)ReadRegularLen:(int)len timeOut:(double)timeout Interval:(double) interval ;
-(NSString *)ReadRegularFormat:(NSString *)format timeOut:(double)timeout Interval:(double)interval ;
-(NSString *)ReadMutableEndStr:(NSString*)data andSubStr:(NSString*)subStr timeOut:(double)timeout Interval:(double) interval ;
-(NSString *)getErrorInfo ;
-(BOOL)ReadSocketPort:(double)tt  usingBlock:(void (^)(NSData *data,size_t len,BOOL *stop))callback;

@end
